package com.youdianda.controller;


import com.youdianda.dto.YddAdvimgDTO;
import com.youdianda.dto.YddAdvimgPageQueryDTO;
import com.youdianda.dto.YddAdvposDTO;
import com.youdianda.result.Result;
import com.youdianda.service.IYddAdvimgService;
import com.youdianda.vo.YddAdvimgPageQueryVO;
import io.swagger.annotations.Api;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author mosen
 * @since 2023-05-15
 */
@RestController
@RequestMapping("/ydd_advimg")
@Slf4j
@Api(tags = "广告图详情")
public class YddAdvimgController {

    @Autowired
    private IYddAdvimgService iYddAdvimgService;

    /**
     * 查询广告图详情
     * @param id
     * @return
     */
    @GetMapping("/rowInfo")
    public Result selectById(Integer id){
        return iYddAdvimgService.selectById(id);
    }


    /**
     * 广告图分页
     * @param yddAdvimgDTO
     * @return
     */
    @GetMapping ("/list")
    public Result<YddAdvimgPageQueryVO> pageQuery(YddAdvimgPageQueryDTO yddAdvimgDTO){
        return iYddAdvimgService.pageQuery(yddAdvimgDTO);
    }


    /**
     * 修改广告图详情
     * @param yddAdvimgDTO
     * @return
     */
    @PostMapping("/update")
    public Result updateAdvimg (@RequestBody YddAdvimgDTO yddAdvimgDTO){

        return iYddAdvimgService.updateAdvimg(yddAdvimgDTO);
    }

    /**
     * 根据ID删除
     * @param id
     * @return
     */
    @GetMapping("/del")
    public Result deleteById(Integer id){
        return iYddAdvimgService.deleteById(id);
    }

    /**
     * 广告图添加
     * @param yddAdvimgDTO
     * @return
     */
    @GetMapping("/add")
    public Result insertAdvimg(@RequestBody YddAdvimgDTO yddAdvimgDTO){
        return iYddAdvimgService.insertAdvimg(yddAdvimgDTO);
    }


















}
